using System.Windows.Input;
using Microsoft.Practices.Composite.Presentation.Commands;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Composite.Regions;
namespace RentAWorker.Management.Shell
{
    public class ShellPresenter
    {
        public IUnityContainer Container { get; set; }
        public IRegionManager RegionManager { get; set; }

        public ShellPresenter(IShellView view, IUnityContainer container, IRegionManager regionMgr)
        {
            this.Container = container;

            this.View = view;
            this.View.CloseTabCommand = new DelegateCommand<object>(CloseTab);

            this.RegionManager = regionMgr;
        }

        private void CloseTab(object par)
        {
            this.RegionManager.Regions["MainRegion"].Remove(par);
        }

        public IShellView View { get; private set; }
    }
}